module.exports = {
   type: 'simple',
  searchRoute: $route('search'),

async fetch({ args }) {
    
    
    var header={headers:{
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7',
'Connection': 'keep-alive',
'Host': 'www.zxcs.me',
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36'
 }}
    //var config = { proxy: { host: '175.154.123.161', port: '9999' },header}

      url = `http://www.zxcs.info/map.html`
    

    let resp = await $http.get(url)
    let html = resp.data
    const $ = cheerio.load(html)
    let list = $('li', '#content')
    let items = []
    list.each((index, li) => {
      let title = $('a', li).text()
      let url = $('a', li).attr('href')
      items.push({
        link: url,
        style: 'list',
        title: title,
        summary: '更新' + $('.riqi', li).text(),
        route: $route('download', {
          url: 'http://www.zxcs.info/download.php?id=' + url.match(/\d+/),
        })
      })
    })
    
    return {
      items: items
    }
    
    
  }
}
